<%@ page language="java" pageEncoding="utf-8"%>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<html>
  <head>
     <title>数据铁笼</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    
     <link rel="shortcut icon" href="res/imgs/home/ht.ico" />
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     <meta http-equiv = "X-UA-Compatible" content = "IE=edge,chrome=1" />
 
     <script type="text/javascript" src="res/pubjs/jquery-1.8.2.js"></script>
     <script type="text/javascript" src="res/pubjs/jquery.easing.js"></script>
     <script type="text/javascript" src="res/pubjs/jquery.easing.compatibility.js"></script>
     
 
     <link rel="stylesheet" href="res/css/default.css" type="text/css"></link>
   
     <link rel="stylesheet" href="res/css/editform.css" type="text/css"></link>
     
     <script src="res/pubjs/layer2.3/layer.js" type="text/javascript"></script>
     
     <link rel="stylesheet" href="res/imgs/pub/iconfont.css" type="text/css"></link>
     <script src="res/pubjs/DatePicker/WdatePicker.js" type="text/javascript"></script>
     
     <link rel="stylesheet" href="res/css/default.css" type="text/css"></link>
     
     <script src="res/pubjs/Ueditor1_4_3/js/ueditor/ueditor.config.js" type="text/javascript"></script>
     
     <script src="res/pubjs/Ueditor1_4_3/js/ueditor/ueditor.all.min.js" type="text/javascript"></script>
 
 
     <link href="res/pubjs/uploadify/uploadifive.css" rel="stylesheet" />
     <script src="res/pubjs/uploadify/jquery.uploadifive.js" type="text/javascript"></script>
     
     
     <link href="res/pubjs/ztree/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css" />
     <script src="res/pubjs/ztree/jquery.ztree.core-3.5.js" type="text/javascript"></script>
     <script src="res/pubjs/ztree/jquery.ztree.exedit-3.5.min.js" type="text/javascript"></script>
     

     
     <script type="text/javascript" src="res/pubjs/lang-zh_CN.js"></script>
 
     <script type="text/javascript" src="res/pubjs/CommonLibJs.js"></script>
    
     <script src="res/js/editform/edit.js" type="text/javascript"></script>

     <link rel="stylesheet" href="res/css/default.css" type="text/css"></link>
    
     
     <script src="res/js/datagridp.js" type="text/javascript"></script>
     <script src="res/js/datagrid_edit.js" type="text/javascript"></script>
     <link rel="stylesheet" href="res/css/datagridp.css" type="text/css"></link>
     <script type="text/javascript" src="res/pubjs/laypage/laypage.js"></script>
 
 
     <script src="res/js/datagrid_edit.js" type="text/javascript"></script>
               
     <script type="text/javascript" src="res/pubjs/easyui-1.4.4/easyloader.js"></script>
 

 
     <style type="text/css">
      
          .ui-form-item{line-height: 23px;height: :23px;width:500px;margin-bottom: 20px;}
          .ui-form-item .ui-label{width:80px;float:left;}
          .ui-form-item .ui-input{width:350px;height: 23px;line-height: 23px;}
          .readonly{background: red;}
          
          .date{}
          
          .c_page{position:absolute;top:47px;left:0;bottom:0;width:100%; overflow: auto;z-index:1000;}
         
          .fxd_tb {width:100%;border-collapse: collapse;}
          .fxd_tb th{border:1px solid #DCD8D8;padding:10px;font-weight: bold;background-color: #F7F7F7;white-space: nowrap;}
          .fxd_tb td{border:1px solid #DCD8D8;padding:6px;}
          .fxd_tb .td1{width:50px;text-align: center;}
          .fxd_tb .td2{width:550px;}
          .fxd_tb .td3{width:100px;text-align: center;}
          .fxd_tb .td4{width:100px;text-align: center;}
          .fxd_tb .td5{width:200px;text-align: center;}
          
          .sp_btn_sel{height: 30px;line-height: 30px;border: 1px solid white;}
          .removedoc ,.downloaddoc{text-decoration: none;}

 
         
         .showsourcetable{text-decoration: none;}
          #zdxmlist td{padding:10px;}
          #zdxmlist td a{text-decoration: none}
          #zdxmlist{margin-bottom:20px}
          
 
        .uploadifive-queue-item{background: white;border-bottom:0;padding:5px;}

        .attach_file div{padding:4px 0;padding-left:25px; background: url("res/imgs/editform/attach.png");background-repeat: no-repeat; }


		.edui-for-hougelou .edui-icon {
		    background-position: -380px 0px;
		}
        
        .hidden{display:none;}
        .formtitle{padding: 0px; margin-top: 20px;font-size: 20px; text-align: center;}
        .formtitle a{color:black;}
        
        .hold_place_subtable .subtableplan{
           border-collapse: collapse;
           width:100%;
        }
        
     
         .hold_place_subtable .subtableplan th{
           background:    #F9F9F9;white-space: nowrap;
          }
         
         .hold_place_subtable .subtableplan th, .hold_place_subtable .subtableplan td{
           border: 1px solid #EAE7E7;
           padding:3px;
         }
         
        
         .groupname_line{border:1px solid #EAE7E7;text-align: center;background: #F9F9F9;padding:4px;font-size:14px;}
        
         .subtableplan th{font-size:12px;font-weight: normal;}
         .subtableplan td{font-size:12px;}
        
         .datagrid_j .grid_body{position: relative !important;}
         .datagrid_j{height:auto !important}
         #grid_ui{width:100%; margin:0 auto;}
       
         #grid_ui .datagrid{width:100%}
         #grid_ui .datagrid td, #grid_ui .datagrid th{border:1px solid  #EAE7E7;}
      </style>
      
  </head>
  
  <body>
  
  
  <div  style="position: absolute;top:0px;left:0;bottom:50px;right:0px;">
      <div style="position: relative;width:100%;height:100%;">
      
 
	      
	       <div id="form_tab1" style="position: absolute;top:0px;left:0px;width:100%;overflow: auto;bottom:0px;">
		     
		     <div id="grid_ui" style="margin-top:10px;margin-bottom:10px;display:none;">
	         
	            <div id="gridid"></div>
	         
	            <div style="padding-top:10px;float:right;margin-bottom:10px;">   
	               <div class="bluebtn" id="btn_top_add" style="display:none">新建</div>
	               <div class="bluebtn" id="btn_top_edit">修改</div>
	               
	            </div> 
	            
	            <div style="clear:both;"></div>
	         </div>
	      
		  
		      <div id="formui" class="maincontent center content_body">
			                             
						          
			  </div>
		  </div>
		  
		  <div id="form_tab2" style="display:none; position: absolute;top:0px;left:0px;z-index:1000; width:100%;bottom:0px;background: white;">
             <iframe id="frame_tab2" src="" style="width:100%;height:100%;" border=0 frameborder="0"></iframe>
          </div> 
  
          <div id="form_tab3" style="display:none; position: absolute;top:49px;left:0px;z-index:1000; width:100%;overflow: auto;bottom:0px;background: white;">
             <div id="form_tab3_body" style="padding:20px;">
             
             </div>
          
          </div> 
          
          
	  </div>
	  
	 
	  
 </div>
 
  
	
	<div id="panel_m" style="position: absolute;bottom:0;left:0;right:0;height:50px; background-color: #F8F8F8; border-top:1px solid #EEEEEE; z-index: 1000;">
	           
	           <div style="position: relative;width:100%;height:100%;">
	               
	               <div id="spyj_div" style=" position: absolute;top:10px;left:0;width:100%; display:none;">
	                <div style="width:900px;height:230px;margin:0 auto;">
	                 <table style="width:900px;margin:0 auto;">
	                
	                
	                  
	                  <tr>
	                  <td style="height:30px;white-space:nowrap;padding:5px;">
	                                                           常用审批意见：
	                  </td>
	                  <td>
	                    <select style="width:200px;"></select>
	                  </td>
	                  </tr>
	                  
	                 <tr>
	                 <td style="white-space:nowrap;padding:5px; vertical-align: top;">
	                                                           审批意见：
	                 </td>
	                 <td style="width:100%;">
	                   <script type="text/plain" id="spyj_text" style="width:100%;height:90px;"></script>
	                 </td>
	                 </tr>
	                 
	                     <tr>
	                  <td style="height:30px;white-space:nowrap;padding:5px;">
	                                                           审批结果：
	                  </td>
	                  <td>
	                    <select id="spjg" style="width:200px;">
	                     <option>通过</option> 
	                     <option>不通过</option> 
	                    </select>
	                  </td>
	                  </tr>
	                  
	                  
	                 </table>
	                 <div style="width:900px;margin-top:5px;">  
	                   <div style="width:300px;margin:0 auto;">
	                     <div id="btn_flowtj" class="bluebtn" style="float:left;  height:25px;line-height:25px;width:88px;">
	                       <i class="iconfont" style="padding:0 4px;">&#xe62b;</i><span style="font-size:16px;">提交流程</span>
	                     </div>
	                     <div id="btn_cancelSp" class="bluebtn" style="margin-left:10px;  float:left; height:25px;line-height:25px;width:88px;">
	                       <i class="iconfont" style="padding:0 4px;">&#xe62c;</i><span style="font-size:16px;">取消提交</span>
	                     </div>
	                   </div>
	                 </div>
	                 </div>
	               </div>
	               
	               
	               
	                 <div style="position: absolute;bottom:10px;left:0;right:0;border-top:1px solid #E6D8D8;  height:40px;">
	                     <div style="padding-top:10px;margin:0 auto;width:280px;" >
		                     <div class="bluebtn" id="btn_save"  style="display:none;">确定</div>
 
			               
			                 <div class="bluebtn" id="btn_showflow"  style="display:none;">查看流程图</div>
			                 <div class="bluebtn" id="btn_closeflow" style="display:none;">关闭流程图</div>
			                 <div class="bluebtn" id="btn_showreport" style="display:none;">打印报表</div>
			                 <div class="bluebtn" id="btn_close">关闭窗体</div>
			               
		                </div>
	              </div>
	           </div>
	         
	
	</div>
	
	
	<!--  <input id="file_upload" name="file_upload" type="file" />
	 <div id="queue">
    </div> -->
	
	
	<input type="file" name="file" accept="image/jpg,image/png,image/gif" lay-ext="jpg|png|gif"  id="file1" style="display:none;">
	
	
  </body>
  <script type="text/javascript">


   var _guid_doc="${_guid_doc}";
   var _edittype="${_edittype}";
   var _childfieldid=GetQueryString("childfieldid");
   if (_childfieldid==undefined){
	   _childfieldid="";
   }
   
   var _guid=GetQueryString("guid");//子集字段添加默认值
   if (_guid==undefined){
	   _guid="";
   }
   
   var _key_value = GetQueryString("keyvalue");
   var _form_save_state={"keyvalue":"","mkeyvalue":"","updatestate":"","datadealid":""};
   var _param=GetQueryString("p");
   
   
   var _datadealid=GetQueryString("datadealid");
   
   var _deptcode=GetQueryString("deptcode");
   if (_deptcode==undefined){
	   _deptcode="";
   }
   
   
   if (_datadealid==undefined){
	   _datadealid="";
   }
   
   
   _form_save_state.datadealid=_datadealid;
   
   if(_param==undefined)
	   _param="";
   else
     _param=decodeURIComponent(_param);
 
   $(document).keydown(function(event) {
		
		 
	      if (event.target.nodeName == 'TEXTAREA' || event.target.nodeName == 'INPUT') {
	          return;
	      };
	      /* Act on the event */
	      if (event.keyCode == 32) {
	          event.preventDefault();
	          return false;
	      };
	  });
   
   
   
   var _mkeyid=GetQueryString("mkeyid");
   
   if (_mkeyid==undefined){
	   _mkeyid="";
   }else{
	   _mkeyid=decodeURIComponent(_mkeyid);
   }
   
   var _show_click_SourceTable=false;
   
   var _bool_updating=false;
   
   var _subflowid=GetQueryString("subflowid");
   if (_subflowid==undefined)
	   _subflowid="";
   else
     _subflowid=decodeURIComponent(_subflowid);
   
   
   var _keyvalue=GetQueryString("keyvalue"); 
   _keyvalue=decodeURIComponent(_keyvalue);
   
   
   _form_save_state.keyvalue=_keyvalue;
   _form_save_state.mkeyvalue=_mkeyid;
   
   
  
   
   
   var fieldorder="";
   /*顶部 grid*/
   function showTopGrid(){
		   
	      var _pagenumber=10000000;
		  
		  var sPageIndex=1;
		  var gridid="gridid";
		  var _datadeal_id="";
		  
 
		  
		  $("#"+gridid).dataGrid("init",{
                 "success":function(res){
                	 
                	  var readonly=res.gridmsg.rd;
                	  
                	  $("#grid_ui").show();
                	  
           		      if (readonly=="0"){          			  
           		    	  $("#btn_top_edit").html("修改");
           			      $("#btn_top_add").show();
           		      }else{
           		    	  
           			     $("#btn_top_edit").html("查看");
           		      
           		      }
           		   
           		   
           		   
                	  
                 },
				 "ismaintable":true,
				 "onDblClick":function(){
					 
					 /*
					 var selId= getSelectDataGridId();
			   		  
		        	 if (selId==""){
		        		  layer.alert("请选择要修改的行！");
		        		 return;
		        	 }
		        	 else {
		        		 opensiji_subflow_edit(selId,_param,"");
		        	  }	
		        	 
		        	 */
				 
					 
					 
				 },
				 
				 "params":{"param":_param,showfoot:false, "pagenumber":_pagenumber,"pageindex":sPageIndex,"gridid":gridid,"keyvalue":_form_save_state.keyvalue,"mkeyvalue":_mkeyid,"ismaintable":0,"fieldorder":fieldorder},
				 "url":"getdatagrid"
  	      });
  	  
		  
		  
		  /*
		  var param={"p":_param,"pagenumber":_pagenumber,"pageindex":sPageIndex,,"gridid":gridid,"fieldorder":fieldorder,"datadealid":_datadeal_id};
		  
     	  
		  jqueryAjax("getdatagrid",param,true,function(res){
			   
			  var res_v=$.parseJSON(res);
			  var grid_body=res_v.gridmsg.grid_body;
			  var gridid=res_v.gridmsg.gridid;
			  
			  $("#"+gridid).dataGrid("refresh",res_v.gridmsg);
			  
			  
			 
			  
			 
			  
		  });  */
	   }
	   
	 
	  
    function loadDataGrid(sPageIndex){
		   
    }
	    
    
    $("#btn_top_edit").click(function(){
 	   
    	 var selId=getDataGridSelectedId("gridid");
 
    	 if (selId.split(",").length>1){
    		 
    		  
       		 layer.alert("请选择单条记录修改！");
       		 
    		 
    		 return;
    	 }
    	 
    	
    	 
    	  
    	 if (selId==""){
   		  layer.alert("请选择要修改的记录！");
   		   return;
   	     }
    	 
    	 
    	_form_save_state.keyvalue=selId;
    	 
    	getFormHtml();
 	    
    }); 
    
    $("#btn_top_add").click(function(){
 	   
    	_form_save_state.keyvalue="";
    	
    	getFormHtml();
    }); 
    
 
    
   function getFormHtml(){
	   /*加载表单*/
	   var param={"p":_param,"subflowid":_subflowid,"datadealid":_form_save_state.datadealid, "keyvalue":_form_save_state.keyvalue,"mkeyvalue":_form_save_state.mkeyvalue,"deptcode":_deptcode};
	   var loadinIndex= layerLoading();
	   jqueryAjax("getformhtml",param,true,function(res){
		   
		
		  
	 	 var res_v=eval("("+res+")");
	 	 
	 	 if (res_v.state=="ok"){
	 		 $("#formui").html(res_v.msg);
	 		 
	 		 
	 		  
	 		 
	 		 	var param={"param":_param,"keyvalue":_keyvalue};
		
		       jqueryAjax("getuploadhostname",param,true,function(res_1){
			
	 
				 var res_v1=$.parseJSON(res_1);
				 if (res_v1.state=="ok"){
					 
					 _gswebhost=res_v1.hostname;
	 
				 }else{
					 
					 _gswebhost="";
				 }
			
	 
			     var planId=res_v.planid;
			     if (planId==undefined){
			    	 planId="";
			     }
			     
			     if (planId!=""){
			    	  $("#btn_showflow").show();
			     }
			   
			     var readonly=res_v.rd;
			     
			     if (readonly==undefined){
			    	 readonly="0";
			     }
			     
			     
			     if(readonly==""){
			    	 
			    	 readonly="0";
			     }
			     
			     
			     if (readonly=="0"){
			    	 $("#btn_save").show(); 
			     }else{
			    	 $("#btn_save").remove(); 
			     }
			     
			     
			    
			     
				 setBigTextUI("formui");
                   
		 		 setFormValue("formui",res_v.value);
		 		 iniTip("formui",_subflowid);
		 		 bindUploadFile("formui",_form_save_state.keyvalue,_guid_doc,_param);
		 		 bindCodeTableField("formui",_param);
		 		 
 
		 		
		 		$("#file1").change(function(){
		 			
	 				 
	 				   
		 			   //上传的时间带上时间戳参数
		 			   jqueryAjax("getuploadtimestamp",null,true,function(res_2){
		 				   
		 				   
		 				   var res_timestamp=$.parseJSON(res_2);
		 				   
		 				   var timestamp=res_timestamp.timestamp;
		 				   
			 			   var formData = new FormData();//构造空对象，下面用append 方法赋值。  
			 			   
				 		   if ($("#file1")[0].files[0]==undefined){
				 		    	  return;
				 		   }
			 			   
			 		       formData.append("file", $("#file1")[0].files[0]);  
			 		       formData.append("timestamp",timestamp);
			 		       
			 		      $("#file1").val("");
			 		      
			 		         var url = _gswebhost+"uploadueditorimg";  
			 		         $.ajax({  
			 		             url : url,  
			 		             type : 'POST',  
			 		             data : formData,  
			 		 
			 		             processData : false,  
			 		          
			 		             contentType : false,  
			 		             success : function(res_img) {  
			 		            	 
			 		            	
			 		            	
			 		            	 if (res_img.state=="ok"){
			 		            		 
			 		            		 var url=_gswebhost+res_img.url;
				 		            	 
				 		            	 _um.execCommand("insertHtml","<img src='"+url+"' />");
			 		            	 }else{
			 		            		 
			 		            		 layerError(res_img.state);
			 		            	 }
			 		            	 
			 		            	

			 		       
			 		             },  
			 		             error : function(responseStr) {  
			 		            	 
			 		            	 layerError( JSON.stringify(responseStr));
			 		                 
			 		             }  
			 		         });  
			 		         
			 		         
		 			   });

		 			   
		 			  

	 				
	 				 
	 			});
	 			
		 		
	 
			
			
		    });
		
		 
		      layer.close(loadinIndex);
		
	 		 //
	 		
	 		
	 		
	 	 }
	 	 else{
	 		 
	 		 layer.closeAll();
	 		 layerError(res_v.state);
	 	 
	      }
	   });
	 	 
	   
   }	
	
   
   
 

  
		 
	if (_edittype=="1"){
		
	//  showTopGrid();
	}	  

 
   getFormHtml();
   

   
   
   $("#btn_formui").click(function(){
	   
	   $(".spbtn").removeClass("sp_btn_sel");
	   $(this).addClass("sp_btn_sel");
	   
	   $("#form_tab1").show();
	   $("#form_tab2").hide();
	   $("#form_tab3").hide();
   });
   
   /*
             显示全部风险点
   */
   $("#btn_showallfxd").click(function(){
	 
	   
	   $("#form_tab1").hide();
	   $("#form_tab2").hide();
	   $("#form_tab3").show();
	   
	   
	   
	   var keyValue=_form_save_state.keyvalue;
 	   var subflowId=_subflowid;
 	   
 	  
 	  $(".spbtn").removeClass("sp_btn_sel");
	  $(this).addClass("sp_btn_sel");
 	  
 	   openAllFxd(subflowId,keyValue);
   }); 
   
   
   function openAllFxd(subflowid,keyValue){
   	 // parent.layerLoading();
   	   
   	 
   	
	   
   	 var param={"subflowid":subflowid,"keyvalue":keyValue};
   	 
   	 jqueryAjax("getfxd",param,true,function(res){
   			
   		 var res_v;
   		 var content_html="";
   		 try{
   			  
   			// parent.layer.closeAll();
   			 res_v=eval("("+res+")");
   			 content_html=res_v.msg;

   		 }
   		 catch(ex) {
   			 
   			 
   			 layerError(ex.message);
   			 
   			 return;
   		 }
   		 
   		
   	       $("#form_tab3_body").html(content_html);
   		


   	 },
   			 
         function(XMLHttpRequest, textStatus, errorThrown){
   		 
   		    openErrorWindow(XMLHttpRequest, textStatus, errorThrown);
   	 });
   	 

    }
   
   
   /*
        流程提交 
   */
   
   function flowtj(spjg,spyj_text,sformid){
	   
 
	   var hqcode_value= saveHqCode(sformid);
	
	   if (hqcode_value==undefined){
			  hqcode_value="";
		  }
	   
	 
		 
	    var param={"p":_param,"subflowid":_subflowid,"keyvalue":_form_save_state.keyvalue,"spyj_text":spyj_text,"hqcode_value":hqcode_value,"kv":_key_value};
	   
 	    jqueryAjax("flowtj",param,true,function(res){
 		 
 		 var res_v;
 		 try{
 			 
 			 res_v=eval("("+res+")");
 			 
 			 if (res_v.state=="ok"){
 				var msg="";
 				var nextspc=res_v.nextspc;
 				if  (nextspc=="已完成"){
 					msg=lang.editform.flowtjsuccess;
 				}
 				else
 				if  (nextspc=="已终止"){
 					msg=lang.editform.flowtjabort;
 				}
 				else{
 					msg="完成流程提交,已流转到【"+nextspc+"】审批层！";
 				}
 				
 
 				layerSuccess(msg,function(){
 					
 					android.ensure()

 				 //	layerClose();
 				 //	cancelSp();

 				});
 				
 
 				 
 			 }else{
 				 
 				 layerError(res_v.state);
 				 return;
 			 }
 			 
 		 }
 		 catch(ex){
 			 layerError(ex.message);
 			 return;
 		 }
 		 
 	 });
 	 
   }
   
   
   $("#btn_flowtj").click(function(){

 
	    var spyj_text=  spyj_text_um.getContent();
	    
	    spyj_text=encodeURIComponent (spyj_text);
	   
	    var spjg=$("#spjg").val();
	    
 
	    flowtj(spjg,spyj_text);
 
	   
   });
   
   
   
   function getreportCount(){
	   
	    var param={"keyvalue":_form_save_state.keyvalue};
	    jqueryAjax("getreportlist",param,true,function(res){
	    	
	    	var res_v=$.parseJSON(res);
	    	var dt_list=res_v.dt_list;
	    	if (dt_list.length>0){
	    		 $("#btn_showreport").show();
	    	}
 
	    });
   }
   
   getreportCount();
   
   $("#btn_showreport").click(function(){
	   
	    var param={"keyvalue":_form_save_state.keyvalue};
	    jqueryAjax("getreportlist",param,true,function(res){
	    	
	    	var res_v=$.parseJSON(res);
	    	var dt_list=res_v.dt_list;
	    	var  reportpath="";
	    	for(var i=0;i<dt_list.length;i++){
	    		reportpath=	dt_list[i].reportpath;
	    	}
	    		
	    	if (reportpath!=""){
	    		window.open(reportpath,"_blank");
	    	}
	    	
	    });
	   
	   
   });
   

   /*
         打开流程图
   */
   
   $("#btn_closeflow").click(function(){
		  $("#form_tab1").show();
		  $("#form_tab2").hide();
		  
		  $("#btn_showflow").show();
	      $("#btn_closeflow").hide();
		
   });
   
   $("#btn_showflow").click(function(){
  
	 /* $("#btn_showflow").hide();
	 $("#btn_closeflow").show(); */
	 
 
	  
	  var param={"keyvalue":_form_save_state.keyvalue};
 
	  jqueryAjax("fromtbgetflowId",param,true,function(res){
		  
		  var res_v;
		  try{
			  res_v=eval("("+res+")");
			  var decode_keyvalue=res_v.keyid;
			  decode_keyvalue=encodeURIComponent(decode_keyvalue);
			  
			  //$("#form_tab1").hide();
			  //$("#form_tab2").show();
			  
			  //$("#form_tab3").hide();
			  
			  var query_param=_param;
			  query_param=encodeURIComponent(query_param);
			 
			  android.openflow("<%=basePath%>"+"showflow?keyvalue="+decode_keyvalue+"&p="+query_param);
			  //$("#frame_tab2").attr("src","showflow?keyvalue="+decode_keyvalue+"&p="+query_param);
			  
 
			  
		  }catch(ex){
			  
			  return;
		  }
		  
		
			 
	  });
	  
	 
   });
   
   $("#btn_upload").click(function(){
		
	 
	   
	   layer.open({
			  type: 2,
			  scrollbar: false,
			  moveOut :true,
			  maxmin: true, //开启最大化最小化按钮
			  area: ['400px', '230px'],
			  
			  title:"上传附件",
			  
			  
			  content: 'uploadfilem?keyvalue='+_form_save_state.keyvalue
			});
		 
		 
	  });
   

   
      $("#btn_close").click(function(){
    	  
    	  android.finish();
    	   
      });
      

   
      
      // 流程提交 
    function saveFlowTj(sformid){
    	
    	 if (_form_save_state.keyvalue==""){
			   layer.alert("请先保存数据！");
			   return;	 
		   }
  	 
  	 
  	 
	     var param={"p":_param,"subflowid":_subflowid,"keyvalue":_form_save_state.keyvalue};
 	 
  	      jqueryAjax("sf_flowtj",param,true,function(res){
  		 
  		 var res_v;
  		 
  		 try{
  			 
  			 res_v=eval("("+res+")");
  			 
  			 
  			 if (res_v.state=="wtj"){
  				 
  				flowtj("","",sformid);
  				
  				 

  			 }else if (res_v.state=="ytj"){
  			 
  				 layer.alert("流程已经流转，无法提交！");
  				 return;
  				 
  				 
  			 }else if (res_v.state=="ok"){
  				
  				 
  				 flowtj("","",sformid);
  				
  	 
  				 
  			 }
  			 

  			 
  		 }catch(ex){
  			 
  			 layerError(ex.msssage);
  			 return;
  			 
  		 }


  	    });
  	 
  	 
    	
    }
     
     $("#openflow_tj").click(function(){
    	 
      
     });

     $("#btn_cancelSp").click(function(){
    	 
    	
    	 cancelSp();
    	  
     });
     
     
     
     function cancelSp(){
    	  $("#spyj_div").hide();
    	  $("#panel_m").css({height:"0px"});
     }
     
     
 	 
    
     function openzdjc_edit(selId,param){
    	 
     }

    	 
    
    
    $("#btn_save").click(function(){
               
 
		   function savezdxmlist(){
		    
			     
			    	
			    	var ids="";
			    	 
			    	if ($("#zdxmlist").length==0){
			    		return;
			    	}
			    		
			    	
			    	
			    	$("#zdxmlist tr").each(function(){
			    	     var sid= $(this).find("input").attr("id");
			    	     var checked= $(this).find("input").prop("checked");
			    	     if (checked==true){
			    	    	 
			    	    	 if (ids==""){
			        	    	 ids=sid;
			        	     }else{
			        	    	 ids=ids+","+sid;
			        	     }
			    	     }
			    	     
			    	 	
			    	});
			    	
			    	 
			    	 var param={"ids":ids,"mkeyid": _form_save_state.keyvalue};
			    	 jqueryAjax("zdxm_savelist",param,true,function(res){
			    		   
			    		 
			    		 
			    	 });
			    	
			    	
		  }
   		   
   			saveForm("form_tab1","formui",_subflowid,_mkeyid,function(res_v){
   				 
   				if (_edittype=="1"){
   					
   				 // showTopGrid();
   				}	  

   				
   				 savezdxmlist();
 
   				 var planid= res_v.planid;
   				 
   				 if (planid==undefined){
   					planid="";
   				 }
   				 
   				 if (planid!=""){
   					 
                   
   					layer.confirm('确定要提交流程吗？', {
   					  title:"提示",
   					  btn: ['确定','取消']  
   					
   					}, function(index){
   					  
   					   saveFlowTj("formui");
   					 
   					   layer.close(index);
   						
   						
   					}, function(){
   					  
   						
   					});
   					 
   					 
   				 
   				 }else{
   					 
   				   layer.alert("保存成功！");
   				 
   				 }
   				 
   				 
   			  
   				
   			});
   			
   		 
        
   	 
    });
    
    
    

    
    
    /*
    下载文档
    */
    function downloadDoc(sid){
    	/*
    	sid=encodeURIComponent(sid);
        window.open("downloadfile?doc_id="+sid,"_blank");
        */
    	downloadDocGyaic(sid);
    	
    	
    }
    
    
    function downloadDocGyaic(sid){
    	
    	sid=encodeURIComponent(sid);
    	var param={"sid":sid};
    	jqueryAjax("getgyaic_addrdown",param,true,function(res){
    		  var addr=res;
    		  window.open(addr+sid,"_blank");
    	});
    	
       
    }
    
    
    
    /*
           删除字段上的附件
    */
    function removeDoc(sid){
    	
    	layer.confirm('是否要删除该附件？', {
    		  btn: ['确定','取消'] //按钮
    		}, function(index){
    			
    		     var param={"docid":sid};
    		     jqueryAjax("removedoc",param,true,function(res){
    		    	  
    		    	 var res_v;
    		    	 try{
    		    		 
    		    		 res_v=eval("("+res+")");
    		    		 if (res_v.state=="ok"){
    		    			 
    		    			 $("#"+res_v.docid).remove();
    		    			 
    		    		 }else{
    		    			 
    		    			layerError(res_v.state);
    		    		 }
    		    		 
    		    		 
    		    	 }catch(ex){
    		    		 
    		    		 layerError(ex.message);
    		    	 }
    		        	
    		     });
    			
    		     layer.close(index);
    		  
    		}, function(){
    		   
    		});	
    	
    }
     


     iniSpyj();
     var spyj_text_um;
 	 function iniSpyj(){
 		 
 		spyj_text_um = UE.getEditor("spyj_text", {
    		 autoHeightEnabled: false,
    		 elementPathEnabled:false,
    		 wordCount:false,

    		 toolbars:   
    			 
    			 [ 
    			    ['fullscreen', 'source', 'undo', 'redo','bold', 'italic', 'underline', 'fontborder', '|', 'forecolor', 'backcolor','fontsize','fontfamily']
    			],
             lang:/^zh/.test(navigator.language || navigator.browserLanguage || navigator.userLanguage) ? 'zh-cn' : 'en',
             
             focus: false,
             onready:function(){
     	    	
    	         this.on('showmessage', function(type, m){
    	        	    
    	                if (m['content'] == '本地保存成功') {
    	                    return true;
    	                }
    	            });

    	     }
         });
 		 
 	 }
  
 	 
 	   function refreshzdxmlist(){
 		 
          
 		   var param={"keyvalue":_form_save_state.keyvalue};
 		   
 		   jqueryAjax("refreshzdxmlist",param,true,function(res){
 			   var res_v=$.parseJSON(res);
 			   if (res_v.state=="ok"){
 				   
 				  $(".hold_place").html(res_v.msg);
 			   }
 			  
 		   });
 	    	 
 	    	
 	    }
 	   
 	  
 	   
 	   function showSourceTable(sfieldid){
 		  
 		  var json= "";
 		  
 		  if (_show_click_SourceTable==true){
 			   json= serialFormJson("formui");
 		  }
 		  
 		  var param={"msg":json,"p":_param, "fieldid":sfieldid,"keyvalue":_form_save_state.keyvalue};
		   
 
		  jqueryAjax("showsourcetable",param,true,function(res){
			  
			  var res_v=$.parseJSON(res);
			  var showurl=res_v.showurl;
			  if (showurl==undefined){
				  showurl="";
			  }
			  
			  if(showurl!=""){
				  window.open(showurl);
			  }
			
		  });
 		   
 	   }
 	   
 	   
 	   
 	  
  </script>
</html>
